1 <?php include ( "inc/connect.inc.php" ); ?>
2 <?php

3
4 if
(isset($_REQUEST['poid'])) {
5     
6     $poid = mysql_real_escape_string($_REQUEST[
'poid']);
7 }
else {
8     header(
'location: index.php');
9 }
10 ob_start();
11 session_start();

12 if
(!isset($_SESSION['user_login'])) {
13     $user =
"";
14     header(
"location: login.php?ono=".$poid."");
15 }

16 else
{
17     $user = $_SESSION[
'user_login'];
18     $result = mysql_query(
"SELECT * FROM user WHERE id='$user'");
19         $get_user_email = mysql_fetch_assoc($result);
20             $uname_db = $get_user_email[
'firstName'];
21             $uemail_db = $get_user_email[
'email'];
22
23             $umob_db = $get_user_email[
'mobile'];
24             $uadd_db = $get_user_email[
'address'];
25 }
26
27
28 $getposts = mysql_query(
"SELECT * FROM products WHERE id ='$poid'") or die(mysql_error());
29                     
if (mysql_num_rows($getposts)) {
30                         $row = mysql_fetch_assoc($getposts);
31                         $id = $row[
'id'];
32                         $pName = $row[
'pName'];
33                         $price = $row[
'price'];
34                         $description = $row[
'description'];
35                         $picture = $row[
'picture'];
36                         $item = $row[
'item'];
37                         $category = $row[
'category'];
38                         $available =$row[
'available'];
39                     }

40
41 //order

42
43 if
(isset($_POST['order'])) {
44 //declere veriable

45 $mbl = $_POST[
'mobile'];
46 $addr = $_POST[
'address'];
47 $quan = $_POST[
'quantity'];
48 //triming name

49     
try {
50         
if(empty($_POST['mobile'])) {
51             
throw new Exception('Mobile can not be empty');
52             
53         }
54         
if(empty($_POST['address'])) {
55             
throw new Exception('Address can not be empty');
56             
57         }
58         
if(empty($_POST['quantity'])) {
59             
throw new Exception('Address can not be empty');
60             
61         }
62
63         
64         
// Check if email already exists
65         
66         
67                         $d = date(
"Y-m-d"); //Year - Month - Day
68                         $timestamp = time();
69                         $date = strtotime(
"+7 day", $timestamp);
70                         $date = date(
'Y-m-d', $date);
71                         
72                         
// send email
73                         $msg =
"
74                         Assalamu Alaikum...
75                         Your Order successfull. Very soon we will send you a verification call.
76                         
77                         "
;
78                         
//if (@mail($uemail_db,"eBuyBD Product Order",$msg, "From:eBuyBD <no-reply@ebuybd.xyz>")) {
79                             
80                         
if(mysql_query("INSERT INTO orders (uid,pid,quantity,oplace,mobile,odate,ddate) VALUES ('$user','$poid',$quan,'$_POST[address]','$_POST[mobile]','$d','$date')")){
81
82                             
//success message
83                         $success_message =
'
84                         <div
class="signupform_content"><h2><font face="bookman">Your order successfull!</font></h2>
85                         <div
class="signupform_text" style="font-size: 18px; text-align: center;">
86                         <font face=
"bookman">
87                             We send you a verification <br> call very soon.
88                         </font></div></div>
';
89                         }
else{
90                             $error_message =
'Something goes wrong!';
91                         }
92                         
//}
93
94     }
95     
catch(Exception $e) {
96         $error_message = $e->getMessage();
97     }
98 }
99
100
101 ?>
102
103 <!DOCTYPE html>
104 <html>
105 <head>
106     <title>SAREE</title>
107     <link rel=
"stylesheet" type="text/css" href="css/style.css">
108     <meta name=
"viewport" content="width=device-width, initial-scale=1">
109 </head>
110 <body style=
"background-image: url(image/homebackgrndimg1.png);">
111     <div
class="homepageheader">
112             <div
class="signinButton loginButton">
113                 <div
class="uiloginbutton signinButton loginButton" style="margin-right: 40px;">
114                     <?php
115                         
if ($user!="") {
116                             echo
'<a style="text-decoration: none; color: #fff;" href="logout.php">LOG OUT</a>';
117                         }
118                         
else {
119                             echo
'<a style="text-decoration: none; color: #fff;" href="signin.php">SIGN IN</a>';
120                         }
121                      ?>
122                     
123                 </div>
124                 <div
class="uiloginbutton signinButton loginButton" style="">
125                     <?php
126                         
if ($user!="") {
127                             echo
'<a style="text-decoration: none; color: #fff;" href="profile.php?uid='.$user.'">Hi '.$uname_db.'</a>';
128                         }
129                         
else {
130                             echo
'<a style="text-decoration: none; color: #fff;" href="login.php">LOG IN</a>';
131                         }
132                      ?>
133                 </div>
134             </div>
135             <div style=
"float: left; margin: 5px 0px 0px 23px;">
136                 <a href=
"index.php">
137                     <img style=
" height: 75px; width: 130px;" src="image/ebuybdlogo.png">
138                 </a>
139             </div>
140             <div
class="">
141                 <div id=
"srcheader">
142                     <form id=
"newsearch" method="get" action="search.php">
143                             <input type=
"text" class="srctextinput" name="keywords" size="21" maxlength="120" placeholder="Search Here..."><input type="submit" value="search" class="srcbutton" >
144                     </form>
145                 <div
class="srcclear"></div>
146                 </div>
147             </div>
148         </div>
149     <div
class="categolis">
150         <table>
151             <tr>
152                 <th>
153                     <a href=
"women/saree.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Saree</a>
154                 </th>
155                 <th><a href=
"women/ornament.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Ornament</a></th>
156                 <th><a href=
"women/watch.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Watch</a></th>
157                 <th><a href=
"women/perfume.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Perfume</a></th>
158                 <th><a href=
"women/hijab.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Hijab</a></th>
159                 <th><a href=
"women/tshirt.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">T-Shirt</a></th>
160                 <th><a href=
"women/footwear.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">FootWear</a></th>
161                 <th><a href=
"women/toilatry.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Toilatry</a></th>
162             </tr>
163         </table>
164     </div>
165     <div
class="holecontainer" style=" padding-top: 20px; padding: 0 20%">
166         <div
class="container signupform_content ">
167             <div>
168
169                 <h2 style=
"padding-bottom: 20px;">Order Form</h2>
170                 <div style=
"float: right;">
171                 <?php
172                     
if(isset($success_message)) {echo $success_message;}
173                     
else {
174                     echo
'
175                         <div
class="">
176                         <div
class="signupform_text"></div>
177                         <div>
178                             <form action=
"" method="POST" class="registration">
179                                 <div
class="signup_form" style=" margin-top: 38px;">
180                                     <div>
181                                         <td>
182                                             <input name=
"mobile" placeholder="Your mobile number" required="required" class="email signupbox" type="text" size="30" value="'.$umob_db.'">
183                                         </td>
184                                     </div>
185                                     <div>
186                                         <td>
187                                             <input name=
"address" id="password-1" required="required" placeholder="Write your full address" class="password signupbox " type="text" size="30" value="'.$uadd_db.'">
188                                         </td>
189                                     </div>
190                                     <div>
191                                         <td>
192                                             <
select onchange="changeAmount()" name="quantity" required="required" id="productAmount" style=" font-size: 20px;
193                                         font-style: italic; margin-bottom: 3px;margin-top: 0px;padding: 14px;line-height: 25px;border-radius: 4px;border: 1px solid #
169E8F;color: #169E8F;margin-left: 0;width: 300px;background-color: transparent;" class="">';
194
195                     
196
197                  ?><?php
198                                                 
for ($i=1; $i<=$available; $i++) {
199                                                     echo
'<option value="'.$i.'">Quantity: '.$i.'</option>';
200                                                 }
201                                             ?>
202                                             <?php echo
'
203                                             </
select>
204                                         </td>
205                                     </div>
206                                     <div>
207                                         <input name=
"order" class="uisignupbutton signupbutton" type="submit" value="Confirm Order">
208                                     </div>
209                                     <div
class="signup_error_msg"> '; ?>
210                                         <?php
211                                             
if (isset($error_message)) {echo $error_message;}
212                                             
213                                         ?>
214                                     <?php echo
'</div>
215                                 </div>
216                             </form>
217                             
218                         </div>
219                     </div>
220
221                     
';
222
223                     }
224
225                  ?>
226                     
227                 </div>
228             </div>
229         </div>
230         <div style=
"float: left; font-size: 23px;">
231             <div>
232                 <?php
233                     echo
'
234                         <ul style=
"float: left;">
235                             <li style=
"float: left; padding: 0px 25px 25px 25px;">
236                                 <div
class="home-prodlist-img"><a href="'.$category.'/view_product.php?pid='.$id.'">
237                                     <img src=
"image/product/'.$item.'/'.$picture.'" class="home-prodlist-imgi">
238                                     </a>
239                                     <div style=
"text-align: center; padding: 0 0 6px 0;"> <span style="font-size: 15px;">'.$pName.'</span><br> Price: <span id="amountText">'.$price.'</span> Tk <span id="aHiddenText" style="display:none">'.$price.'</span></div>
240                                 </div>
241                                 
242                             </li>
243                         </ul>
244                     
';
245                 ?>
246             </div>
247
248         </div>
249     </div>
250     <script type=
"text/javascript">
251     function changeAmount() {
252         
var v = document.getElementById("aHiddenText").innerHTML;
253         document.getElementById(
"amountText").innerHTML = v;
254         
var sBox = document.getElementById("productAmount");
255         
var y = sBox.value;
256         
var x = document.getElementById("amountText").innerHTML;
257         
var y = parseInt(y);
258         
var x = parseInt(x);
259         document.getElementById(
"amountText").innerHTML = x+"x"+y+ " = " + x*y;
260     }
261     </script>
262 </body>
263 </html>


Gõ tìm kiếm nhanh...